<script setup>
import { onMounted } from 'vue'
import * as echarts from 'echarts'

onMounted(() => {
  const chartDom = document.getElementById('visitChart')
  const myChart = echarts.init(chartDom)
  
  const option = {
    tooltip: {
      trigger: 'axis'
    },
    legend: {
      data: ['未完成日程', '已完成日程', '重要程度']
    },
    xAxis: {
      type: 'category',
      data: ['Jan', 'Feb', 'Mar', 'Apr', 'May', 'Jun', 'July', 'Aug', 'Sep', 'Oct', 'Nov', 'Dec']
    },
    yAxis: [
      {
        type: 'value',
        name: '数量'
      },
      {
        type: 'value',
        name: '重要程度'
      }
    ],
    series: [
      {
        name: '未完成日程',
        type: 'bar',
        data: [120, 150, 90, 200, 70, 130, 40, 150, 80, 30, 120, 130]
      },
      {
        name: '已完成日程',
        type: 'bar',
        data: [100, 140, 90, 210, 110, 60, 20, 180, 70, 140, 160, 160]
      },
      {
        name: '重要程度',
        type: 'line',
        yAxisIndex: 1,
        data: [20, 25, 38, 30, 28, 26, 23, 29, 32, 31, 35, 38]
      }
    ]
  }

  myChart.setOption(option)
})
</script>

<template>
  <div id="visitChart" style="width: 100%; height: 400px;"></div>
</template> 